import { Controller, Get } from '@nestjs/common';
// import { AppService } from './app.service';
import { UserService } from './modules/user/user.service';
import { User } from './modules/user/models/user.entity';

@Controller()
export class AppController {
  // constructor(private readonly appService: AppService) {}

  // @Get()
  // getHello(): string {
  //   return this.appService.getHello();
  // }

  // 我自己定义的user
  constructor(private readonly userService: UserService){}

  @Get('/create')
  async create():Promise<boolean>{
    return await this.userService.create({
      name:'超级管理员',
      desc:'管理员',
      tel:'8800888',
      password:'123456',
      account:'admin',
    })
  }

  @Get('/del')
  async del():Promise<boolean>{
    return await this.userService.del('f3e2ac17-189a-4d15-9c00-99a459820cce')
  }
  @Get('/update')
  async update():Promise<boolean>{
    return await this.userService.update('db7d886d-cf03-44ce-a078-501b2b20c8f9',{
      name:'超级管理员456',
      desc:'管理员123',
      tel:'8800888000',
      password:'123456',
      account:'admin',
    })
  }
  @Get('/find')
  async find():Promise<User | null>{
    return await this.userService.findById('db7d886d-cf03-44ce-a078-501b2b20c8f9')
  }
}
